package com.ctbri.arrays;

import java.util.Arrays;
import java.util.Comparator;

public class Ex21 {

	public static void main(String[] args) {
		BerylliumSphere[] a = Generated.array(new BerylliumSphere[4], 
				new BerylliumSphereGenerator());
		System.out.println("before sorting:");
		System.out.println(Arrays.toString(a));
		Arrays.sort(a, new Comparator<BerylliumSphere>() {
			@Override
			public int compare(BerylliumSphere b1, BerylliumSphere b2) {
				return (b1.id < b2.id ? -1 : (b1.id == b2.id ? 0 : 1));
			}
		});
		System.out.println("after soring:");
		System.out.println(Arrays.toString(a));
	}

}
